package com.xinxin.blockchain.enums;

import com.xinxin.blockchain.constant.RedisKeyConstant;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author ys
 * @date 2021/5/20
 */
@Getter
@AllArgsConstructor
public enum MsgCodeTypeEnum {

    SIGN_UP_IN(1, "注册/登陆", RedisKeyConstant.CODE_MSG_SIGN_UP_IN),
    VALIDATE(2, "验证", RedisKeyConstant.CODE_MSG_VALIDATE),
    RESET_PASSWORD(3, "重置密码", RedisKeyConstant.CODE_MSG_RESET_PASSWORD),
    ;

    private int type;
    private String desc;
    private String redisKey;

    public static MsgCodeTypeEnum getByType(int type) {
        for (MsgCodeTypeEnum value : MsgCodeTypeEnum.values()) {
            if (value.type == type) {
                return value;
            }
        }

        return null;
    }
}
